/*
B. AccurateLee
cf_20_6_23_1369B
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10;
char s[maxn];
int flag[maxn];
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		memset(flag,0,sizeof(flag));
		int n;
		scanf("%d",&n);
		scanf(" %s",s+1);
		int cnt = 0;
		for(int i = n;i>=1;i--)
		{
			if(s[i]=='1'&&cnt)
			{
				for(int j = i;j<=i+cnt-1;j++)
				{
					flag[j] = 1;		
				}
				cnt = 1;
			}
			else if(s[i]=='0') cnt++;
		}
		for(int i = 1;i<=n;i++)
		{
			if(!flag[i]) printf("%c",s[i]);
		}
		printf("\n");
	}
}
